package com.ysd.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ysd.model.Admin;
import com.ysd.service.IAdminService;

@Controller
public class AdminController {
	
	@Resource
	private IAdminService adminService;

	@RequestMapping("login")
	public String login(Admin a,HttpSession session){
		Admin admin = adminService.login(a);
		if(admin!=null){
			return "index";
		}else{
			return "login";
		}
	}
	
	@RequestMapping("addAdmin")
	public String addAdmin(Admin a){
		int n = adminService.addAdmin(a);
		if(n>0){
			return "login";
		}else{
			return "error";
		}
	}
}
